Fix errors in js