Fix the tmpdir location

The tmpdir location used to come from options.tmp_dir, even inside the
class where it was forced to read it as a global variable. It now comes
from tmpdir, the argument passed into the function.