forgot to set chi_square = 0.0 instead of 1.0. i dont know why it was set like that in the first place tbh, but that was the small bug i had that was giving me slightly wrong numbers