         }
 
         API.shared.fetch(MeRequest()) { [weak self] result in
-            self?.stopLoading()
+            guard let strongSelf = self else { return }
+
+            strongSelf.stopLoading()
+            SocketManager.removeConnectionHandler(token: strongSelf.socketHandlerToken)
+
             if let user = result?.user {
                 if user.username != nil {
 
                     DispatchQueue.main.async {
-                        self?.dismiss(animated: true, completion: nil)
+                        strongSelf.dismiss(animated: true, completion: nil)
                         AppManager.reloadApp()
                     }
                 } else {
                     DispatchQueue.main.async {
-                        self?.performSegue(withIdentifier: "RequestUsername", sender: nil)
+                        strongSelf.performSegue(withIdentifier: "RequestUsername", sender: nil)
                     }
                 }
             }

    var serverPublicSettings: AuthSettings?
    var temporary2FACode: String?

    var loginServicesToken: NotificationToken?

    @IBOutlet weak var viewFields: UIView! {

        }

        self.updateAuthenticationMethods()

        SocketManager.addConnectionHandler(token: socketHandlerToken, handler: self)
    }

    override func viewDidAppear(_ animated: Bool) {
