More resilient to API issues. Fixes #9