refine the style
fix some bugs