Improve in-operation handling

Fixes #941