Fix permit session bug