fix index error when we have zero datasets