Fix Flag logic. implement protection listeners.