some perf improvements