Bugfixes.

Almost ready for publication.