proper logout error handling