] Fix code from Stoyan's comments
] Switch from 3 iterations of the fit to 1 iteration by default
] Fix two problems reported from static analyzer