write to tmp dir in all cases