Minor patches to socket api