Adds some missing error handling logic.