Fix precision bugs on ending time