Improve in-operation handling

Fixes #914