Fix case where resulting file is bigger than original