improve type inference of function arguments