Some more minor bug fixes and tweaks