Added draining of input sockets.