fixed all issues with usernames. Added support for automatic login.