improve module loader codes in auto discover