fixes to gfx code