Fixed more javascript to match jquery