Nesting groups with inputs directly connected caused stack overflow.

Fixes #22