fixed more db macro and module macro problems (also fixed #158)