Fix variable name in error handling code