relayout and bug fix