Fix segfault when switching maps
Added heaps of CHECK_OPENGL_ERROR macro calls