added check for class correctness