Various fixes, perf work