             }
             //  load session user before calling onComplete
             self.fileStore.asyncUsers(withUserIds: [userId], success: { (users) in
-                if let user = users.first as? MXMyUser {
+                if let user = users.first {
                     self.myUser = user
                 }
                 onComplete?()

    private var credentials: MXCredentials
    //  real store
    private var fileStore: MXFileStore!
    private var myUser: MXMyUser?
    
    init(withCredentials credentials: MXCredentials) {
        self.credentials = credentials

    
    //  Override and return a user to be stored on session.myUser
    override func user(withUserId userId: String) -> MXUser? {
        if userId == credentials.userId, let myUser = myUser {
            //  if asking for session user and myUser is set, return that
            return myUser
        }
        return MXUser(userId: userId)
    }
