fix update function, delete document key on update