Fixed function to only update the field if different