Add hack to fix genbox

Using a lighter-weight neighbour search is a better idea, but this bug
needs fixing right now.

Add integration tests for major functionality of genbox. These pass
only with the fix in this patch. These are not the most glorious
tests, but as demonstrated by this bug, "does not segfault in routine
workflows" is useful.

Fixes #1393

Change-Id: I5628f52cd91dcb64d66e690b2e611e524f450972