fixed minor bug in JS