fixed bug in 'to' time calculation