change the layout and fix some bugs.