Merge pull request #2 from riking/master

Optimization and fixes.
Safely ignore NPCs who trigger events