Fixed #1198: Error when querying performance counters, improved error reporting