debug: add safe wait for unit test