fix type inference errors