Fix sleep bugs