Fix some problems logging out