replace wait_for_condition