fixed bugs so scans files correctly now