Added some code to detect when we overflow our frame buffer or write over a frame without reading it