define the layer before you set the flags.