Ensuring temp_dir is a string.