Fix array overflow, improve tests fairness