Hopefully resolved bug with checking if user is logged in