Correctly unwrap buffer before release it