stop code from doing undefined bitshift ops

fixes #307