Fixes a major issue with nested filter lookup

When a nested filter was present, it would not properly terminate the
outer loop which resulted in over parsing and breaking complex
templates.