fix bug on sleep