Fix store consistency checking bugs.

Change-Id: I6fbc680e0ac2abfc8108aff2f77f70cd53db65db