Be smarter about checking file locations

Fixes #128.