Ported to new task states
Sleep a bit to make the test more stable...