Fixed issue with previous date calculation