Fixes bugs caused by reusing buffers (apparently).