Fixes #563
Merge pull request #566 from scraperwiki/fix-bug-563

Actually fixes #563 with tests