fixed checking for custom intermediate tags