fixed templing bug with recent optional changes