bugfix: use sleep instead of wait