Fixed bugs with shifting