fixed a problem with sleeping