Fixed minor bug in JS