Bug fixes to layout