init scratch space when writing