Fixing of potentially serious bugs in estimation

- The issues, particularly with measurement error and the overwriting of variable positions in the first run, might affect other routines like estimation via DLL as those routine might rely on the overwriting of data. Someone should look into that.
- I added a unit test, but I think GitHub did not want to commit and upload the data and mode-file. Those files might need to be added and the unit test added to the makefile.