fill out missing definition of isValid