[BUGFIX] Apply fieldmapping before checking if a reference already
exists