Fixed a bug for logged in users