Fix various integration tests

See detailed description in each individual commit for more info.
It's just for logging, so meh. But declaring `result` outside the `try`-`catch` doesn't seem to be needed?