changed logic in wait_for_status method