replace_object: use struct members instead of an array