JS tweaks and fixes