ensuring length is cast an an int when adding len(data)

This fixes an error when length is not cast as an int when provided to this function.  Found this error on Kali Linux using v 0.10.