Fixed broken JS code (#718)