Resolve aliases when scanning directories Fixes #1507

The bug was basically just a typo.