Cleanup error handling; don't jump to an err: label in the middle of a
function.