Fixed faulty generation of surrogate ids
Merge pull request #772 from jidel/issue#771-missing_dunning

Fixed faulty generation of surrogate ids