template fix for the way return values work in r