improved test for waiting