Added exception handling in coroutine