Fix bug in margin calculation.