layouter improvement, bug fixes