Fix errors in JS