fixed minor issues with js code