minor bug fixes and improvements to performance and logging