Logic fix