fix type conversion bug