fixed bug in path string sanitizer function