fixes for keeping connection and clearing incoming messages