Correctly resolve the template blocks if the nesting level is greater than 1