 		defer {CFWriteStreamClose(stream)}
 		
 		var sizes = [Int: Int32]()
-		_ = try write(BSONObject: BSONObject, toStream: stream, options: opt.union(.skipSizes), sizeFoundCallback: { offset, size in
+		_ = try write(BSONObject: BSONObject, toStream: stream, options: opt.union(.skipSizes), initialWritePosition: 0, sizes: nil, sizeFoundCallback: { offset, size in
 			assert(sizes[offset] == nil)
 			sizes[offset] = size
 		})

		return size
	}
	
	private class func write(CEncodedString str: String, toStream stream: OutputStream) throws -> Int {
		var written = 0
		

		return data
	}
	
	/** Write the given BSON object to a write stream.
	
	- Returns: The number of bytes written. */
	class func write(BSONObject: BSONDoc, toStream stream: OutputStream, options opt: BSONWritingOptions) throws -> Int {
		return try write(BSONObject: BSONObject, toStream: stream, options: opt, initialWritePosition: 0, sizes: nil, sizeFoundCallback: {_,_ in})
	}
	
	class func sizesOfBSONObject(_ obj: BSONDoc) throws -> [Int] {
