Fixed thread restart in case of error in coroutine resume.