re-factor unsafeCoerce use to hack opengl