Fix bug in js