made the sourcepathdetection smarter