User isn't redirected to correct page after logging in

After struggling to get the payment workflow working correctly, I now ran into a different issue.

Whenever a user is done with the workflow of creating an account and buying a subscription, he is forwarded back from PayPal. What I notice is that the user is not logged in, and instead of being forwarded to the right page, he gets a "content not found" error. (What page is he supposed to be forwarded to?)

I tried logging in and then going back to the PayPal page, and it seems that it is trying to forward the user to the registration page.
(Using a web proxy, I also double checked that the user is being forwarded to Why is it hardcoded to that permalink? The permalink to my registration page is /purchase.