Added more checks for weird inputs for reading chunks of files.