Fixes to some error checking code.