Performance tests and bug fixes