addded checkDirty call