Fixed a bug where record instances become out of sync.

This fixes a bug where the record instance in @records becomes out of sync with the instance in @irecords when options.clear is set to true.