fixes issues #2212, #1721, #2167, #881
Merge pull request #2239 from mastef/2.x

match existing field ids with imported field ids