[BUG #8185] fix test glitch
[BUG #8185] also test for intermediate keys
[BUG #8185] add more tests