fixed bugs related to macro creation, increased test coverage