JS bug fixes