Recently, my 2014 Buick Verano's (2.4L Ecotec engine) check engine light came on. It would turn on and off seemingly randomly though between engine starts.
I took it to a retail auto parts chain to get it scanned, and the code was P0013 "Variable Valve Timing". Some additional research pointed to two sensors on the top of the engine that should be replaced. These are the sensors as seen on the engine (wires disconnected):
So I bought some replacement sensors and installed them while the check engine light was on. After doing so, the check engine light was no longer on. However, some days later, the light came back on.
Assuming the replacement parts aren't also defective, what else can I try to troubleshoot this? I also heard I may need the code to be wiped out of the computer, however I was under the impression that so long as whatever the issue was that was causing the code was corrected, it should automatically turn the light off and keep it off.

