handling sparse idxs/beta correctly