bug fixes, performance improvements