Avoid traversing same object twice when copying objects

This is a performance fix.  The output is unchanged.

Fixes #28.