Logout and minor bug fixes