Numerous minor bug fixes.