handle directory case