Fix a crashier due to incorrect type conversion