haxe 2.10 & haxe 3 compatibility. Thanks to as3boyan