Indoor positioning technologies have been widely used in many industrial applications such as intelligent inventory management and assembly control. Ultra-Wide Band (UWB) can provide sub-metre level positioning accuracy at a distance of several dozen metres with high robustness. However, UWB measurements can be contaminated by reflected, refracted and deflected signal in practice, the contaminated measurements are outliers in data processing and degrade the positioning performance if they are not treated properly. In indoor environments, UWB signals may penetrate some structures/materials and these refracted signals are outliers in data processing for position determination. This paper investigates the statistical distribution of errors due to refracted/penetrated signals. Classification and Regression random forests are used to detect outlier measurements and apply error mitigation, respectively. Two datasets are collected to cross-validate the proposed method. The results show that the proposed method can achieve a detection accuracy of about 80%. Besides, the datasets show that rejecting detected outlier measurements and applying error mitigation can improve distance measurement accuracy by 80%.