fix context creation when passing an HTMLCanvasElement