Problems with unconstrained estimation fixed

Pointed out by Raf. Wouters