[BUG #8185] enhance testability
[BUG #8185] add more tests