@davejgreen thanks for the report, I have fixed it. The issue was that CURDATE is used in two separate queries but the code assumed it's the same value in both queries. Thus the first query can return something values for CURDATE, but the second one may not since CURDATE has changed.