bugfixes, calculating means on intervals correctly
removed some debugging lines