Fix return values and type inference for return.