check path first
Merge pull request #322 from newscred/fix-path-error

check path first