RC522 RFID Reader stop working after several attemps

Hello, I got my reader from ebay, and connected and looks to be working but with a problem.I don’t know why, but my code works for several times and then stop reading the card. I want to make it react to ANY card. So basically put a card and switches the relay on and the off. That’s it.
Here is my code:

#include <SPI.h>
#include <MFRC522.h>

#define SS_PIN 10
#define RST_PIN 5
#define RELAY1  7                        


MFRC522 mfrc522(SS_PIN, RST_PIN);	// Create MFRC522 instance.

void(* resetFunc) (void) = 0;//declare reset function at address 0


void setup() {
	Serial.begin(9600);	// Initialize serial communications with the PC
	SPI.begin();			// Init SPI bus
	mfrc522.PCD_Init();	// Init MFRC522 card
        pinMode(RELAY1, OUTPUT);    

}

void loop() {
	// Look for new cards
	if ( ! mfrc522.PICC_IsNewCardPresent()) {
  
  return; 
	}

	// Select one of the cards
	if ( ! mfrc522.PICC_ReadCardSerial()) {
		
  
  return;
	}
digitalWrite(RELAY1,LOW);           // Turns ON Relays 1
delay(100);                                      // Wait 
digitalWrite(RELAY1,HIGH);          // Turns Relay Off
	// Dump debug info about the card. PICC_HaltA() is automatically called.
mfrc522.PICC_DumpToSerial(&(mfrc522.uid)) ;
 


}

Does anyone has an Idea?

void(* resetFunc) (void) = 0;//declare reset function at address 0 is actually not present in the code, I was testing this function

The MFRC522 library has pretty good error handling. Perhaps you should obtain and decode the status information from the library calls you’re making to determine what’s going wrong. Look at how this example uses the status printing:

For example:

Serial.print(F("Reading data from block ")); Serial.print(blockAddr);
Serial.println(F(" ..."));
status = mfrc522.MIFARE_Read(blockAddr, buffer, &size);
if (status != MFRC522::STATUS_OK) {
   Serial.print(F("MIFARE_Read() failed: "));
   Serial.println(mfrc522.GetStatusCodeName(status));
}

Adding some debugging will likely reveal what is going on in your instance, In any event, it couldn’t hurt.