fix a little problem in gen_maSter_* functions and reorganize the batch reduce routines