What is the name of your state? Virginia

I recently received a ticket for defective equipment (for a driver's side rear light out). Law section 46.2-1003 in the va traffic code. Five months prior to receiving the ticket, the vehicle has been vandalized and an after market tail light assembly was put in. I had problems with the light assembly and had already changed the bulb once a few weeks prior to the ticket. A few days before I was pulled over for the citation, the light was in proper working order. So, needless to say, I did not know the light was out when the officer stopped me. Therefore, I thought I was going to receive a warning. He instead gave me the ticket and said he was doing me a favor by not giving me an extra ticket for not having my registration in the vehicle. I would like to know if this is worth fighting in court since everyone I have spoken with said it is ridiculous that I was given the ticket instead of a warning.

Thanks for your help -
tcinva