Fixed memory leak, fixed issue with Statistics