Time-of-Arrival (ToA) based localization has attracted considerable attention for solving the very complex and challenging problem of indoor localization, mainly due to its fine range estimation process. However, ToA-based localization systems are very vulnerable to the blockage of the direct path (DP) and occurrence of undetected direct path (UDP) conditions. Erroneous detection of other multipath components as DP, which corresponds to the true distance between transmitter and receiver, introduces substantial ranging and localization error into ToA-based systems. Therefore, in order to enable robust and accurate ToA-based indoor localization, it is important to identify and mitigate occurrence of DP blockage. In this paper we present two methodologies to identify and mitigate the UDP conditions in indoor environments. We first introduce our identification technique which utilizes the statistics of radio propagation channel metrics along with binary hypothesis testing and then we introduce our novel identification technique which integrates the same statistics into a neural network architecture. We analyze each approach and the effects of neural network parameters on the accuracy of the localization system. We also compare the results of the two approaches in a sample indoor environment using both real-time measurement and ray tracing simulation. The identification metrics are extracted from wideband frequency-domain measurements conducted in a typical office building with a system bandwidth of 500 MHz, centered around 1 GHz. Then we show that with the knowledge of the channel condition, it is possible to improve the localization performance by mitigating those UDP-induced ranging errors. Finally, we compare the standard deviation of localization error of traditional localization system and UDP identification-enhanced localization system with their respective lower bound.