fixes Handlebars error if elements referenced are not available

Fixes #2698