Fixed a bug with being unable to encode