The verb should agree with the person and number of the subject. Sometimes, it agrees with a nearby noun that is in the same sentence instead of its proper subject. This is called an error of proximity. It must be avoided.