Fixes #306.
Merge pull request #542 from philipn/fix_loaddata

Fixes #306.