beforeSave bug fixed