Fix a bug in getUnit