Minor bug fixes and performance improvements.