Fixed a bug in class edit function