Light non existing checking, improved matching for define and template tags
Mode fix