Proper fix for long interaction.

Fixes #1078 and #1038.