delete some useless spaces and use path.join