handle relative_path_from failures + refactor