Switching active frame/layer causes Replace Color to stop functioning

I hit a wall, so I’m asking it here. I try to do a replace color for the active layer including frames.
When I change the active laye or frame through app.activeLayer or app.activeFrame, the replace function doesn’t fire (or stops in the middle reverting its changes)

Is app.command.ReplaceColor getting stopped by the change in layer/frame?