Fixed bug in solving the damping.
Various smaller fixes.