Unable to update document using a script