This fixes #7385 and fixes #7386.  It now correctly gets the type with averages and the last action.