We study the behaviour of an atom-cavity system exposed to a stimulated Raman adiabatic passage (STIRAP) process in a four-level system, with a coupling scheme which generate two degenerate dark states. We find that the non-adiabatic interaction of the two dark states guarantees that the cavity Fock states can always be generated by both intuitively and counterintuitively ordered pulses. Furthermore, we propose a method to entangle two atoms. Depending on the ordering of the pulses two orthogonal entangled states can be prepared. Since these entangled states do not have component of the excited states included, the technique is robust against the detrimental consequences of spontaneous emission.