minor revise on the function adjustTitleWidth