Make disconnect event more reliable