Added connection-detached handler