added more checks for username and groupname