Updated to handle --read-batch mode. This actually fixes a potential