Fix warning check logic