Fix AddAveragePlugin bugs