resolve nested relative template, fixes #1622