bug fixes performance improvements