Fixed property of non-object when viewing a page while not logged in.