Updated isDirty to handle null values