only save mapping if necessary
Merge pull request #57 from dimagi/perf3

only save mapping if necessary