lib.connection: clean up