implement checkValidity