added handling for possible dirty state