changed buffer from string to bytes in socket reading