Bug fix: array index cannot be larger than 10 in margins