Fixing minor JS errors