Improve robustness (I got a case where path is dict!?)