Fix types and conversion