bugfix for nested template and loops rebind