Fix Pyglet 1.2 compatibility. Probably not the right one, but it works.