Fix bug in change detection