to_read =  length - bytes_read if to_read > (length - bytes_read)