right way to check if class exist