fixing a type conversion problem