Several bug fixes and layout fixes.