Add statistics log, bugfixes