Fix the assumption that files have a unique basename.