fixed total gain miscalculation