improved the exception for date class