Fix get_earned_credit bug