Corrected had conditions