A system for tracking a position of an object, comprising two or more field generators (44), whcih are arranged to generate respective magnetic fields in a vicinity of the object a field sensor (52), which is associated with the object and comprises one or more field sensing elements, which is arranged to measure field strengths of the magnetic fields, wherein a measurement of at least one of the field strengths is subject to a distortion and a processor, which is arranged to identify responsively to the measured field strengths a distortion-contributing system element, which is selected from a group consisting of the one or more field sensing elements and the two or more field generators, and to determine the position of the object relative to the two or more field generators while disregarding field measurements associated with the distortion-contributing system element.