Lots of small fixes.