Fixed some issues in confidence iterval code, still not perfect, but much better