fix a error when no --dir arg is passed