Fixed flipped logic issue