Fix width calculation problems when maxWidth and minWidth are used