Adding a prev_state column. Fixing validated->invalidated not taken into...

... account in stats.