Fix some display issues and optimize multiline text in box construction