fixed bug in date check