Various minor bug fixes.