fix outbuf, fix leak in select, out headers in select when no rows