Fix error in type conversion