Make more resilient to error conditions