Fix behaviour for dirs with nonexisting parents