adding valid check