Various fixes and tweaks.