Protect against bug with symlinks
Corrected catch, added a test