fixing variable name in error handling