Improve the uom changing logic