correcting conditional code