Fix a number of bugs related to wrapping with action metrics