correcting reversed logic