update SleepMode.java to not block thread