added protection for errors in provider calls