Fixed calculation error with margin and padding prefix/suffix