Fix various integration tests

See detailed description in each individual commit for more info.
Bit too paranoid, methinks.