Invert: bug fix + format