Fixing JS errors