fixed handling of very big files (long wasn't used consequently)