Added GL error checking