redirect to the last page not working