     init(rawSession: RawSession) throws {
         guard let cChannel = libssh2_channel_open_ex(rawSession.cSession,
                                                      RawChannel.session,
-                                                     UInt32(RawChannel.session.characters.count),
+                                                     UInt32(RawChannel.session.count),
                                                      RawChannel.windowDefault,
                                                      RawChannel.packetDefault, nil, 0) else {
                                                         throw LibSSH2Error.initializationError

    func exec(command: String) throws {
        let code = libssh2_channel_process_startup(cChannel,
                                                   RawChannel.exec,
                                                   UInt32(RawChannel.exec.characters.count),
                                                   command,
                                                   UInt32(command.characters.count))
        try LibSSH2Error.check(code: code)
    }
    

    func authenticate(username: String, privateKey: String, publicKey: String, passphrase: String?) throws {
        let code = libssh2_userauth_publickey_fromfile_ex(cSession,
                                                          username,
                                                          UInt32(username.count),
                                                          publicKey,
                                                          privateKey,
                                                          passphrase)
