A bit kludgy, but fixes #224.
Merge pull request #233 from standage/attrcheck

A bit kludgy, but fixes #224.