Bug fixes; make codegen program tree map more directly to JS