Cover more remaining branches with tests
This is mostly test change to increase test line coverage of previously missed paths. During the testing I identified one "dead" code block, which is fixed to be executable, but it should really not make any changes as such operations are not used by anything I saw before.