Fixed issue with endless loop on last day of month check