added shift length validation