Fixing a bug in changing units