added error condition to check_url