fixed tracking references in to_array()