fix re-connection on foreground