Misc performance updates and bugfixes