Modified the code of the flying counter example.