Fixing invalid JS