Can I see a copy of the login page? The only cause I can think of would be if the login page isn't setting the UserName session variable correctly.
You can test that theory. Add this to line 19 of the account.php page:
See if there is a session variable for UserName set and if it is set to the value you expect.