Dirty check bug fixed

I made a mistake in dirty check functionality.

Undoing/redoing when there is no action to undo/redo should not change the dirty counter.