Fixed a bug with encodings