correction of some js code