additional test coverage and bug fixes