Fix interversion between source and target for references