fix js codegen
fix infinite loop