Fixed a huge error in the way logs were handled. Fixed most Tests, without them I wouldn't have looked into this difficult to find bug.