shuffle function fix