     }
     static func bytes(_ string : String) -> [UInt8]{
         let data = string.data(using: String.Encoding.utf8)!
-        return [UInt8](UnsafeBufferPointer<UInt8>(start: UnsafePointer<UInt8>((data as NSData).bytes), count: data.count))
+        return [UInt8](UnsafeBufferPointer<UInt8>(start: (data as NSData).bytes.bindMemory(to: UInt8.self, capacity: data.count), count: data.count))
     }
     static func string(_ bytes : [UInt8]) -> String{
         if let str = NSString(bytes: bytes, length: bytes.count, encoding: String.Encoding.utf8.rawValue) {

                frame = try readFrameFragment(nil)
                finished = frame.finished
            }
            if frame.code == .continu{
                throw WebSocketError.protocolError("leader frame cannot be a continue frame")
            }
            if !finished {

            while outputBytesStart+outputBytesLength+length > size {
                size *= 2
            }
            let ptr = realloc(outputBytes, size).assumingMemoryBound(to: UInt8.self)
            outputBytes = ptr
            outputBytesSize = size
        }
