fixed minor bug in js