time calculation minor bug fix