Fixed: bugs when adding or editing classes