Some minor bug fixes.
Moar bugfixes.