Sorry for the late reply on this but I fear you are returning a reference to a variable that's on the stack (and hence out-of-scope by the time control returns from the call). The bit pattern maybe there in memory but you are making an illegal access.
Lets see the code snippet for the function and we can help.