Fix typo. Slightly more explicit exception checking in _contains_only.