Fixed inversion error