put a condition to validate class exists or not

put a condition to validate class exists or not