test on existing file or directory, fixes #2