move if wait to a more logical place in the check_availability code