Layout: bug fixes