Change all int to int64

See #133.
I think is bad compute of `remaining`.