Fixes for bugs in Buffer, tweak test to pass.
Merge branch 'buffer-operations'