Fixed some JS issues