fixed inverse calculation. Version 1.1