Fix some JS quality flaws