Fix type conversion error breaking large files

In my opinion it’s better to have to cast than to have wrong results.