Fix bug where the mask pointer is not reset when a new buffer is started