Fixed templateid nesting bug

Change-Id: I3abed24f9d22fddf6af9a283d424e6e9719d3c23
Signed-off-by: Jeremy Ho <jujaga@gmail.com>