bugfixes in memory pre-allocation and statistics code