Fixed 1.8.7 bug screwing up chapters; Using Dir.mktmpdir