 	if not IS_WINDOWS and not fs.existsSync(devicePath)
 		return callback(new Error("Invalid device: #{devicePath}"))
 
-	imageFileStream = fs.createReadStream(imagePath)
+	imageFileSize = fs.statSync(imagePath).size
 
-	deviceFileStream = fs.createWriteStream(devicePath, flags: 'rs+')
-	deviceFileStream.on('error', callback)
-
-	imageFileSize = fs.statSync(imagePath).size
+	if imageFileSize is 0
+		return callback(new Error("Invalid OS image: #{imagePath}. The image is 0 bytes."))
 
 	progress = progressStream
 		length: imageFileSize

			exports.rescanDrives(callback)

		(callback) ->
			imageFileStream
				.pipe(progress)
				.pipe(deviceFileStream)

	async.waterfall([

		(callback) ->
			fs.open(devicePath, DISK_IO_FLAGS, null, callback)

		(fd, callback) ->
			buffer = new Buffer(bufferSize)
