fix python statistics logger

Bug of initial feature implemented in #398.

@forouher FYI