On stability of endomorphisms