Lots of tiny bug fixes.