codeword detection fixes