Fixes deadlock when user call operations inside listeners

fixes #2971