Fixed some issues with logging out