Fixed a rounding error in threadDelay