Wrong variable used inside the block

The method #insert_record should use the loop variable as the argument.