fix an isdirectory check