Added class name checking to the set function as well.