Check for $ref['_elem'] before using it.
Check for array members before using them.
Merge pull request #11 from samwilson/check-for-elem

Check for $ref['_elem'] before using it.