fix garbage collect not working on cursor and connection objects