fix flags behaviour