better handling for directory paths that contain whitespace