fixed bug in js