Minor change: removed duplicated code in `flush` method.

Refactored `flush` to use `clear` method instead of repeating the code
from this method.
Fixed #177: Condition was not reset when collector was reset

If a collector has an reset="true" attribute one would expect that this
also resets the state of an if-condition in the collector. However, this
was not the case. This commits fixes this.

Please note that this may change the behaviour of existing scripts if
they relied on the condition not being reset with the reset of the
collector.