Fixed some bugs I discovered while running it on Kraken
Merge branch 'master' of github.com:wikimedia/kraken