Fix a bug related to unmanaged files
Refactor statistics