Bug in date check