Bug fixes and tweaks.