A few minor bugfixes and tweaks.