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