Fixed condense_path function