fixed bug where the isValid flag was not persisted.