fixed arithmetic error in postprocessing
fixed iteration counter in optimize