get the read size right in extend.  Thanks to xxopxe@gmail.com
fix up accidental global variables.  Thanks on Ashwyn Hirschi