Fixing bug in static type inference