Fixed build failure on recent gcc, due to using header that was included by other headers. (APSW issue 640)
Fixed reference count leak due to incorrect reference count handling. The main symptom would be connections not automatically being garbage collected. (APSW issue 641)