Fix some bugs about layout