fixed bug which was causing a nan when timeTotalMs was set to 0.