check for existence of directory before trying to get files from it

this should fix #18