fixed the connection management thing