Fix some JS kludginess