fix small bugs in js