Fix function types and typo