Fix error variable mismatch; update function call for consistency