fixing bugs/fixed encoding