Fix some bugs with function types.