More bug fixes and tweaks.