fixed some JS issues