Logic fix for error testing