Added some checks to prevent warnings when a file is smaller than the norm.