changed check to isdir