Fixed bug where failed records were duplicated