moved pdf_redirect test into correct block