improve jsafx-impl.js