fix bug introduced by shuffling