only treat last arg as callback if it's a function