lab4 fixed encoding