Fixed bugs in `rshift` subroutine.