Various fixes to shuffle