added operateFlag

conditional not working right