performance and bug fixes