More Haxe 3.1.2 compatibility fixes.

Unfortunately TypeUtil.as() no longer works
with module private classes.