make the module use grep instead of opendir
fix uninitialized warnings