Fixing bug about enconding