update layout and fix some bugs.