move set_value call out of lock