Fix leftovers from the refactoring

Another commit which fixes a range of bugs that resulted from the
refactoring. Luckily, all found by the tests.

Signed-off-by: Konrad Reiche <konrad.reiche@gmail.com>