fix inverted comparitor