Added check for space in path