change layout code to work with selectionInCenter
fix crash while drawing dividers