 	private var networkFailure: Bool = false
 	private var semaphore: Threading.Event?
 	
-	class ReferenceBuffer {
-		var b: UnsafeMutablePointer<UInt8>
+	final class ReferenceBuffer {
+		var a: [UInt8]
 		let size: Int
 		init(size: Int) {
 			self.size = size
-			self.b = UnsafeMutablePointer<UInt8>.allocatingCapacity(size)
-		}
-		
-		deinit {
-			self.b.deallocateCapacity(self.size)
+			self.a = [UInt8](repeating: 0, count: size)
+		}
+		
+		subscript(by: Int) -> UnsafeMutablePointer<Void> {
+			return UnsafeMutablePointer<Void>(self.a).advanced(by: by)
 		}
 	}
 	

	#endif
	
	private func completeArray(from frm: ReferenceBuffer, count: Int) -> [UInt8] {
		
		var ary = [UInt8](repeating: 0, count: count)
		for index in 0..<count {
			ary[index] = frm.b[index]
		}
		return ary
	}
	
	func readBytesFully(into int: ReferenceBuffer, read: Int, remaining: Int, timeoutSeconds: Double, completion: ([UInt8]?) -> ()) {
		let readCount = recv(into: int.b + read, count: remaining)
		if readCount == 0 {
			completion(nil) // disconnect
		} else if self.isEAgain(err: readCount) {
			
			// no data available. wait
			self.readBytesFullyIncomplete(into: int, read: read, remaining: remaining, timeoutSeconds: timeoutSeconds, completion: completion)
			
		} else if readCount < 0 {
			completion(nil) // networking or other error

	public func readSomeBytes(count cnt: Int, completion: ([UInt8]?) -> ()) {
		
		let ptr = ReferenceBuffer(size: cnt)
		let readCount = recv(into: ptr[0], count: cnt)
		if readCount == 0 {
			completion(nil)
		} else if self.isEAgain(err: readCount) {
