removed deprecation warnings for StringIO methods by changing bytes to each_byte