r2: cleanup and set the macro states correctly