resolved resource leaks preventing proper socket passing