Alq3-based organic light emitting diodes (OLEDs) were prepared by molecular beam deposition in Ultra-High Vacuum (UHV) and their electrical properties were studied by impedance spectroscopy before they were exposed to any impurity gases. To characterize the fundamental injection processes, we studied the simplest OLED structure, consisting of a single layer of Alq3 between an ITO anode and a Mg cathode. In UHV, and below the threshold voltage for luminescent, instabilities in the frequency dependence of the resistivity, as well as in the current vs. voltage characteristics, are observed, which could be related to inhomogeneous contacting at the electrodes. When the same experiment is performed in air, both kinds of instabilities disappear, which demonstrates that exposure to atmospheric gas plays a role in stabilizing the contact and injection properties in the devices. Additionally, the impedance spectrum in air below the threshold voltage for luminescent shows an additional feature that hints to two different regions in the Alq3 layer, which we assign to the effect of Mg atoms which diffused into the Alq3 layer during deposition.