mor erefactoring and defensive code in the CodecFileIterator