fix inverted logic