reflect session.onstatechange correctly