Fix "TypeError bufsize must be an integer"

Change-Id: I3ae9edab2505c37945fe66863721913a6d33223c