fixing more template bugs