lib: proper detach from shared pool