Improved error messages a bit, fixed bug in gl_state