Position-sensing apparatus is provided, including a set of radiators, which are adapted to be placed at respective positions in a vicinity of a body of a subject and to generate electromagnetic energy fields. A position sensor, is adapted to generate sensor signals responsive to the energy fields. One or more reference elements, are adapted to be placed at respective positions in a vicinity of the sensor and to generate reference signals responsive to the energy fields. A control unit is adapted to determine, for each of the reference elements, respective undistorted reference parameters, responsive to the known positions of the reference elements. The control unit additionally receives the sensor signals and the reference signals, and calculates a reference element error for each reference element, responsive to an interaction of a metal article with the energy fields, the undistorted reference parameter of the reference element, and the reference signal generated by the reference element. The control unit then calculates a position of the sensor, responsive to the sensor signals and the reference element errors.