gh-37: fix incorrect file resizing with big values, fixes gh-37.