Accurate temperature measurements in the presence of field inhomogeneities