Fix for U4-3908 YSOD on frontend after being logged out

Fixed and tested. Resolved the issues I had with 7.0.1 on local test site.