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