bug-fix: testing directory's validity