Fix refactor-induced error-handling issues found during debugging/testing.