fix TypeError when input is unicode already