fix some connection fd assertions and fix possible read of free'd memory