Fixed bunch of JS errors/warning