It should redirect back to the url used to access the page in the first place. The code uses: $_SERVER['REQUEST_URI'] as the return page redirect.
Maybe you have it set to members.php on the login page? In that case you may be able to find and replace the reference there.