  We present in this work an analysis of the damage imposed by the atom on the
field state inside a lossy superconducting cavity. To access such effects, we
propose two procedures to preserve a qubit of the decay effects of an imperfect
quantum memory: the first by means of an quasi-instantaneous phase kick applied
in the atom, and the second by means of controlled resonant and dispersive
interactions. We immediately demonstrate that, in both procedures, the dwell
time of the qubit in the cavity increases significantly, being expressively
higher for the second. A relation between the inaccuracy of the preparation of
the atomic beam and the quality of the cavity arises naturally from our
calculations for each procedure. This result is unprecedented, and sets out the
rules to increase the dwell time of the qubit.
