fixing allocations, not fully done