bugfixes uncovered by perf test