improve layout and fix bug related to duplicated blocks