Fix setting an element's value to a document/array