Fixed checkValidity to check strictly