fixed few bugs for loging out