fixed parsing error and date comparison bugs