only save mapping if necessary