Fixed errors with performance counters

#3004
#2859