corrected errors in npc code