fixed bug for setting start and end time