fix register/deregister server sent event bug.