Fixing bugs.

Logistic results are wrong. There are more bugs.