more fixes for #323

This fixes various problems I ran into during functional testing. 

Some of these were self-inflicted by my previous PR.

Lots of side-stuff is included here, mainly w.r.t. fixing missing deps.

The commit messages should be clear w.r.t. giving a summary.