fix errors after estimation and/or optimization