Fix JS error on logout