Fixed a porting error and the tests that created unnecessary copies of buffers. Works on 0.11.4 and 0.10.15.