Fix time caculations