Research and bug fixes

Fixed a nasty error in the computation of msmin and msmax in the
accumulate methods. Found this bug by looking at 3D plots of alignment
errors.
Merge branch 'master' into dev