Maybe the redirect code is positioned wrong on the page. I think it sets a variable with the redirect page and then code runs to redirect based on that variable. If the code that redirects was somehow above the code that sets the redirect it would do what you describe.
Really there are probably a lot of possibilities given the limited information provided.