many bugfixes, but there's still a problem in the monte carlo book keeping