checking validity