caching of pathmap and clean option
fix logic flaw