Fix for NoneType issues related to redirects