fix type inference issues