Fix sleep and wake up