hack to support functions with two and three arguments