Fix implementation of state record and item record comparison.