issue #21605: Get error checking right and remove unneeded functions.