changed end time calculation for JSON