correctly retrieve user name for logging purposes