Minor bugfixes.

See commit history.