Fixed some date checking