fixed bug, added inversioninsertion