Corrected undefined variable error in validate_username function