add "set_if_present" helper function