Add a safeguard for template references without a bundle

Accessing the bundle parameter is only possible for template references
from FrameworkBundle. Places using the component class won't be able to
get it.
Closes #331