Repared split_path function