Merge "Check for state before disconnecting." into gingerbread