Workaround a BUG in isdir.