Improve test coverage
Merge upstream changes