better logged-on-user function, fixed null pointer exception