fixing time calculations