add better test coverage
(cherry picked from commit 8f017e9)