Fix sleep time computation