fixed and improved query call trace profiling. Related #1375