Minor correction in JS functions