fixed connection reference to an instance object

instead of a local object

When `:chunk_size` is used, the `connection` object cannot be found. This fixes the reference error.