more macro and bug fix