Bug on tearing down connection