try to be "correct" with oid generation.

I will implement a series of faster ways to do this, but we should
have a correct one (even if it is slow) to compare against.