Some fixes to minor errors found while debugging.