fixed bug for no-directory case