Removed error in regression algorithm

Removed a stupid bug in regression.
Also corrected the fit part.
Adapted test script for a not exactly zero result (no big deal but
otherwise confusing failure messages show up).