Make path calculation safer.