fixed another NameError in the encoder