Fixing 'data should be either a binary or a string'

Sometimes an integer is passed i.e. timeout=30.
Also, type_text won't catch something like to='client:1' etc..
In these conditions the error 'data should be either a binary or a string' is being raised.
Thus convert all to utf-8 except int, and remove exception