Fixed a bug in comp_used calculation