adding some helper to check validity