Buffer::do_insert: fix on_insert call when inserting at the end