Fix error in buffer_coalesce()

This should fix the assertion failure reported by @eponymous4473 in #97.