removed a sleep() in tests, using a timeout instead as sleep can't guarantee the expected behaviour