fix index and count total credit