bugfix: invalid result of getSegBoundaries()

replaced NextSeg() with SegEnd()
patch in the product decoder.
more error checks on resolve()

also report meaningful data in the exception.