Fixed error in keystream gen introduced during refactoring