Fixed a bug in logout