Fix erros

Erros: inverse function
Upgrade: main function