Adding another clause to check for directories in the false case of type checking

Fix to tighten up checking for types