Several bugfixes.
Improvements and more (in)sanity.