Fix crashing on some OpenGL versions