More reliable implementation on finding import path