Fix macro expansion bugs