Improve the uom changing checking logic