Minor bugfixes and tweaks.