Fixed logging in and some bugs with UserDB.