descrambler: move the key change code to proper location