minor changes on js function for sample