fix corruption of pasted data, remove old cruft