backport the destroy method from the oldie gist