compilation fixes, added in code to try to catch NANs from Minuit2 before they wreck the calculation