* Fix errors being nested. Make code more resilient to this situation * address review comments * code review comment