Fix the assumption that a file's basename is unique