Fix boolean conditions being the wrong way around.