work on #332 for hand-written js