More concise version of the collapse of duplicated files on load bugfix