Bug in the calucaltion of chi square values regarding the overflow in
the double solved!