fix some bugs , javascript