sm_macrofix

found a bug in the logic and fixed it