Fix for swapBuffers crash