added check of type of class.