Clean up store.c store_object_similar() and fix a bug.

The test for well-balanced items is broken.