Avoid ValueError getting the collection offset.

Fixes issue #337.