added hasChanges check, corrected typo in test