fix JS  bugs