Correctly handle paths with spaces