Fixed an issue where not all files were scanned. Improved filename uniquification.