Fix invalid expression types

This can cause a NPE in the FunctionRegistry because we end up with
arguments that have no type