Fix connection deallocation

Hi,

please contact me if you need any more info.

Thank you