fix a bug: device won't sleep