If we say, you see, that the function of the dream is to safeguard sleep, and to fulfil wishes, then it's clear that in the real world not all wishes are fulfillable and it may well be that, that the latent thoughts, in some cases, is so alarming and so disturbing, that they cannot be sufficiently disguised and will lead to a state of waking, and that waking proves of course that the dream has failed in its function of safeguarding sleep.