increase max iteration limit, and fix crash on empty html tags
fix keys() and items() for Templates