Added logging, attempts to fix connect/disconnect issue