Remove files generated in case of error. Fix usage of iotas.