Some major/minor bug fixes.