Moved buffer_segment_unlink code