optimized wait_ready function