bug fixing for units