fixed problem with empty parent_dir

If parent_dir is empty then the test failed. The new code checks to see if there is even a parent_dir to test the existence of.