Various small bug fixes.