fix bytes handling