Fixed counting gems bug.