And it works now, incl. the unit tests. Thanks for the hint!

Changed.