bug in chooseShift() fixed