small fixes & js printer refactoring