Fix XtzRenderToBuffer Function