User sign-up: dynamic redirects are not working for me

Hello!

I have implemented this cookbook recipe regarding user sign-up into my site but it is not working as expected for me:

It seems there is a problem with the site method because I always end up on the homepage no matter from what page I started the login or registration process.

How can I check if the login.referrer is stored properly in a session or pulled from a session?

Otherwise the registration and login / logout process is working fine.

Thanks for any hints!
Alex