updated for datefrom and dateto checking issues