Fig bug in split_buffer where input was being discarded

Also, write some tests for it.
Merge pull request #47 from orchardup/fix-split-buffer

Fig bug in split_buffer where input was being discarded