Possible problem with npc not following

I have this happen a couple of times now.
I get an npc to follow me, but they run off in the opposite direction. I’ve tried changing their settings to only attack what’s in reach and follow me if you see me run, but they keep running away to attack an enmy 30 odd tiles away.