fix occasional crash when copying / pasting