fixed all memory corruptions ... TODO: change memory allocation policy
seems solved TODO merging issue