Fix some code that was supposed to ensure that a buffer was terminated, but was