Fixed bug with npc detection