type infer error bug fix