fixed some JS errors