check validity before returning