Implement auto reconnection