Fixed bugs related to performance counters
Some tweaks to service loop