Fix problems with division under Python 3.

data_size fix might be too cautious - I both use moddiv and cast to int.