Fix sleep overflow bug