Perhaps u become lucid right at the end of your rem cycle. I know that sounds unlikely but it happens alot to me. It is deeply frustrating if you can't re-enter the lucid.