MV YF Counter Control state not going away.

http://www.yanfly.moe/wiki/Counter_Control_(YEP)

Im trying to make a counter skill that evades the next source of damage and counter attacks. I tried tons of different things and nothing at all works.
Also the counter is just a normal attack and not the proper skill.

This is how my state is set up with the trait counter attack 100% in state. I would like the state not to go away at end of battle and only happens once.

Code:
<Counter Skills: 9>
<Counter Total: 1>
<Evade Counter>
<Custom Deselect Effect>
if (action && action.isForOpponent() && this.isPhysical()) {
target.removeState(77); }
</Custom Deselect Effect>

Edit: It does not counter when the enemy does Double attack either :S

Original thread: https://forums.rpgmakerweb.com/threads/yf-counter-control-state-not-going-away.127367/