Fix issue with time delta calculation