Fixed invert if issue