Fix potential file clobbering