[BUGFIX] Template identifier should check parent

Fixes bug introduced in #300