Fix coroutine mode and add test