Fix crash when changing the position of an NPC from script. Fix #434.