add the function of visualization and fix some bugs