fix bug with date checking