fixed bug for time_end