use custom document in patch correctly