fix end time in db