Fixed some bugs on code layout.