Fixed the issue where modifying the class while leaving the parent unchanged raises a 'parent is already ancestor' error