optimized pathsanitise again

hopefully now it won't break stuff