Fixed bug with SetDirty