fix bad conditional logic