perf fixes and minor changes