use defined to handle directories named "0" (amends prev. merge)