Fixed relationship id generator issue in multiple input groups

Previously multiple input groups would have the id sequence of
relationships restarted from 0.