groupByNodes() was buggy in several cases
Merge branch 'f_groupbynodes'

* f_groupbynodes:
  groupByNodes() was buggy in several cases