updated check_number method