partial implementation of isValid