Bugfixes to process_corpus.rb