Fix bound of gather loop
Merge pull request #328 from OP2/fix-gather-loop-size

Fix bound of gather loop

Fixes #326