(fix) Refactored to avoid dropping uninit memory.