fixed a bundle of JS issues