Various fixes to previously-committed untested code.