added emulate sleep