This is dubious. Isn't there a better way to verify the function type?