Trying to fix bugs in mass inverse calculation