bug fixes for layout