Type checking for function and function call