fix errors in js